home *** CD-ROM | disk | FTP | other *** search
/ Champak 139 / (Vol 139) Sep 24 2011.iso / Games / theme_park_thriller.swf / scripts / frame_55 / DoAction.as
Text File  |  2011-09-24  |  2KB  |  60 lines

  1. Map.attachMovie("player","Player",playerStartRow * 100 + playerDepth);
  2. Map.Player._x = (playerStartColumn - 1) * tileWidth + tileHalf;
  3. Map.Player._y = (playerStartRow - 1) * tileHeight + tileHalf;
  4. Map.Player.currentRow = playerStartRow;
  5. Map.Player.currentColumn = playerStartColumn;
  6. Map.Player.speed = playerSpeed;
  7. mascotsActive = [];
  8. mascotIndex = 1;
  9. var i = 1;
  10. while(i <= numOfMascots)
  11. {
  12.    spawnMascot();
  13.    i++;
  14. }
  15. centerMap();
  16. Interface.gotoAndPlay("GetReady");
  17. stop();
  18. Interface.onEnterFrame = function()
  19. {
  20.    this.bakersText = _root.bakersHelped + "/" + _root.numOfBakers;
  21. };
  22. Map.Player.onEnterFrame = function()
  23. {
  24.    if(gameInPlay)
  25.    {
  26.       this.lastX = this._x;
  27.       this.lastY = this._y;
  28.       this.lastDir = this.currentDir;
  29.       this.currentRow = Math.ceil(this._y / tileHeight);
  30.       this.currentColumn = Math.ceil(this._x / tileWidth);
  31.       this.currentTile = whatNumber(this.currentColumn,this.currentRow);
  32.       if(Key.isDown(38))
  33.       {
  34.          this.currentDir = "Up";
  35.          moveClip(this);
  36.       }
  37.       else if(Key.isDown(40))
  38.       {
  39.          this.currentDir = "Down";
  40.          moveClip(this);
  41.       }
  42.       else if(Key.isDown(37))
  43.       {
  44.          this.currentDir = "Left";
  45.          moveClip(this);
  46.       }
  47.       else if(Key.isDown(39))
  48.       {
  49.          this.currentDir = "Right";
  50.          moveClip(this);
  51.       }
  52.       else
  53.       {
  54.          this.gotoAndStop("Idle");
  55.       }
  56.    }
  57.    centerMap(4);
  58.    this.swapDepths(this.currentRow * 1000 + playerDepth + this.currentColumn);
  59. };
  60.